package name.vaccari.matteo.tai.chat.domain;

public class Message {

	private final String text;
	private final String author;

	public Message(String text, String author) {
		this.text = text;
		this.author = author;
	}

	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getText() == null) ? 0 : getText().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof Message))
			return false;
		Message other = (Message) obj;
		if (getText() == null) {
			if (other.getText() != null)
				return false;
		} else if (!getText().equals(other.getText()))
			return false;
		return true;
	}

	public String getText() {
		return text;
	}


	@Override
	public String toString() {
		return "<" + text + ">";
	}

	
}
